package com.cskaoyan.service.wx;

import com.cskaoyan.bean.CategoryId;
import com.cskaoyan.bean.CategoryIdExample;
import com.cskaoyan.mapper.CategoryIdMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
@Service
public class WxCatalogServiceImpl implements WxCatalogService {
    @Autowired
    CategoryIdMapper categoryIdMapper;

    @Override
    public List<CategoryId> queryCategoryByPid(int pid) {
        CategoryIdExample categoryIdExample = new CategoryIdExample();
        CategoryIdExample.Criteria criteria = categoryIdExample.createCriteria();
        criteria.andPidEqualTo(pid);
        List<CategoryId> categoryIds = categoryIdMapper.selectByExample(categoryIdExample);
        return categoryIds;
    }

    @Override
    public List<CategoryId> queryCategoryByidNpid(int id, int pid) {
        CategoryIdExample categoryIdExample = new CategoryIdExample();
        CategoryIdExample.Criteria criteria = categoryIdExample.createCriteria();
        criteria.andPidEqualTo(pid).andIdEqualTo(id);
        List<CategoryId> categoryIds = categoryIdMapper.selectByExample(categoryIdExample);
        return categoryIds;
    }
}
